package com.example.designpatterns.builder;

/**
 * 建造者模式演示类
 */
public class BuilderDemo {
    public static void main(String[] args) {
        // 创建指挥者
        Director director = new Director();
        
        // 创建建造者
        Builder builder = new ConcreteBuilder();
        
        // 构建完整产品
        System.out.println("===== 构建完整产品 =====");
        Product product1 = director.construct(builder);
        product1.show();
        
        // 构建简化产品
        System.out.println("\n===== 构建简化产品 =====");
        Product product2 = director.constructSimple(builder);
        product2.show();
        
        // 直接使用建造者构建产品
        System.out.println("\n===== 直接使用建造者构建产品 =====");
        Builder builder2 = new ConcreteBuilder();
        builder2.buildPartA();
        builder2.buildPartB();
        Product product3 = builder2.getResult();
        product3.show();
    }
} 